package org.qf.web;

import org.qf.pojo.SmbmsProvider;
import org.qf.pojo.SmbmsRole;
import org.qf.pojo.SmbmsUser;
import org.qf.service.SmbmsProviderService;
import org.qf.service.SmbmsRoleService;
import org.qf.service.SmbmsUserService;
import org.qf.service.impl.SmbmsProviderServiceImpl;
import org.qf.service.impl.SmbmsRoleServiceImpl;
import org.qf.service.impl.SmbmsUserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author young
 * @create 2021-01-14-17:35
 * @description
 */
@WebServlet(value = "/updateProviderServlet")
public class ProViderUpdateShowServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

            String id=req.getParameter("id");
            Long ids=0L;
            if(id!=null)
            {
                ids=Long.parseLong(id);
            }
        SmbmsProviderService smbmsProviderService=new SmbmsProviderServiceImpl();
        try {
            SmbmsProvider smbmsProvider=smbmsProviderService.queryByid(ids);
            if(null!=smbmsProvider)
            {
                req.setAttribute("u",smbmsProvider);
                req.getRequestDispatcher("providerUpdate.jsp").forward(req,resp);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
